import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class File2 {
    public static void main(String[] args) throws IOException {
        String src = "D:\\project\\test1.txt";
        String des = "D:\\project\\test2.txt";
        //在操作文件之前,一定要先打开文件
        //以读的形式打开
        FileInputStream fileInputStream = new FileInputStream(src);
        //以写的形式打开
        FileOutputStream fileOutputStream = new FileOutputStream(des);
        while(true){
            int ch = fileInputStream.read();
            if (ch == -1){
                break;
            }
            fileOutputStream.write(ch);
        }
        fileInputStream.close();
        fileOutputStream.close();
    }
}
